package java_thinking.unit_19._19_7_9;

/**
 * @Desc:   19.7 使用接口组织枚举
 * @author: cww
 * @DateTime: 2019-05-22 23:36
 */
public interface Food {
    enum Appetizer implements Food {
        SALAD, SOUP, SPRING_ROLLS;
    }
    enum MainCourse implements Food {
        LASAGNE, BURRITO, PAD_THAI, LENTILS, HUMMOUS, VIDALOO;
    }
    enum Dessert implements Food {
        TIRAMISU, GELATO, BLACK_FORST_CAKE,FRUIT, CREME_CARAMEL;
    }
    enum Coffee implements Food {
        BLACK_COFFEE, DECAF_COFFEE, ESPRESSO, LATTE, CAPPUCCINO, TEA, HERB_TEA;
    }
}

/**
 * 都可以向上转型为food
 */
class TypeOfFood {
    public static void main(String[] args) {
        Food food = Food.Appetizer.SALAD;
        System.out.println(food);
        food = Food.MainCourse.LASAGNE;
        System.out.println(food);
        food = Food.Dessert.GELATO;
        System.out.println(food);
        food = Food.Coffee.CAPPUCCINO;
        System.out.println(food);
    }
}
